package com.hongfeng.web.service.impl;

import java.util.Iterator;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hongfeng.web.dao.BuyInfoDao;
import com.hongfeng.web.model.BuyInfo;
import com.hongfeng.web.service.BuyInfoService;

@Service
public class BuyInfoServiceImpl implements BuyInfoService {
	
	@Resource
	private BuyInfoDao buyInfoDao;

	public List<BuyInfo> findAll() {
		return this.buyInfoDao.findAll();
	}

	/**
	 * 求购信息
	 */
	public List<BuyInfo> findBuyInfoByType(String typeCode) {
		List<BuyInfo> infos = this.findAll();
		Iterator<BuyInfo> it = infos.iterator();   
		while(it.hasNext()){   
			BuyInfo info = it.next();   
		    if(!"001".equals(info.getBuyInfoType().getCode())){   
		        it.remove();   
		    }   
		}   
		return infos;
	}

}
